import request from "@/utils/request";

//获取全部信息
export const getAnnouncementList=(data) =>{
    return request.get("/admin/announcementList", {params : data})
}

//增加公告
export const addNotice = (form) =>{
    return request({
        method:"POST",
        url:"/admin/addAnnouncement",
        data: JSON.stringify({
            content: form.content,
            status:form.status,
        }),
        headers: {
            'Content-Type': 'application/json'
        }
    })
}

//编辑公告
export const editNotice = (form) => {
    return request({
        method:"PUT",
        url:"/admin/updateAnnouncementById",
        data: JSON.stringify({
            id: form.id,
            content: form.content,
            status:form.status,
        }),
        headers: {
            'Content-Type': 'application/json'
        }
    })
    return res.data;
}

//删除公告
export const delFrom =  (form) => {
    return request({
        method:"DELETE",
        url:"/admin/deleteAnnouncementIds",
        data: form,
        headers: {
            'Content-Type': 'application/json'
        }
    })
}
